<template>
<h1>表单组件</h1>
  <el-form label-width="100px">
    <el-form-item label="用户名:">
      <el-input v-model="user.username" placeholder="请输入用户名"></el-input>
    </el-form-item>
    <el-form-item label="密码:">
      <el-input v-model="user.password" placeholder="请输入密码"></el-input>
    </el-form-item>
    <el-form-item label="性别:">
      <el-radio-group v-model="user.gender">
        <el-radio-button label="男"></el-radio-button>
        <el-radio-button label="女"></el-radio-button>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="所在地:">
      <el-select v-model="user.city">
        <el-option label="北京" value="北京"></el-option>
        <el-option label="上海" value="上海"></el-option>
        <el-option label="广州" value="广州"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="管理员:">
      <el-switch v-model="user.isAdmin"></el-switch>
    </el-form-item>
    <el-form-item>
      <el-button @click="reg()">注册</el-button>
    </el-form-item>
  </el-form>
</template>

<script setup>
import {ref} from "vue";
import {ElMessage} from "element-plus";

const user = ref({username:"",password:"",gender:"",city:"",isAdmin:true});
const gender = ref('');
const city = ref('');
const isAdmin = ref('');
const reg =() =>{
  ElMessage.success("恭喜用户"+user.value.username+"注册成功")
}
</script>

<style scoped>

</style>